import React from 'react'
import { useCountDown } from '../../hooks/useCountDown'
import { getLoginCode } from '../../api'
import {
  Form,
  Input,
  Button,
} from 'antd-mobile'
import { useNavigate } from 'react-router-dom'
function Index() {
  // const [form] = Form.useForm()
  // const getRandomCode = () => {
  //   form.validateFields(['tel']).then(async({ tel }).)
  // }
  // const onFinish=()=>{
  // }
  const navigate=useNavigate()
  return (
    <div>
      <Form
        layout='horizontal'
        footer={
          <Button block type='submit' color='primary' size='large' onClick={()=>navigate('/home')}>
            登录
          </Button>
        }
      >
        <Form.Item
          name='tel'
          label='手机号'
          // form={form}
          // onFinish={onFinish}
          rules={[{ required: true, message: '手机号不能为空' },
          { pattern: /^1[3-9]\d{9}$/, message: '必须为手机号格式' }

          ]}
        >
          <Input onChange={console.log} placeholder='请输入手机号' />
        </Form.Item>
        <Form.Item
          name='telCode'
          label='验证码'
          rules={[{ required: true, message: '验证码不能为空' }]}
          extra={<Button type='button' color='primary'>获取验证码</Button>}
        >
          <Input onChange={console.log} placeholder='请输入验证码' />
        </Form.Item>

      </Form>
    </div>
  )
}

export default Index